/**
 * Created by Administrator on 2017/3/23 0023.
 */
var Page9={
    create:function () {
        var page={};

        page.ui=new PIXI.DisplayObjectContainer();

        var bg=new PIXI.Graphics();
        bg.beginFill(0x0,1);
        bg.drawRect(0,0,pixiStageW,pixiStageH);
        bg.endFill();
        page.ui.addChild(bg);

        var arr=[];
        for(var i=0;i<43;i++)
        {
            if(i<10)
            {
                arr.push(resource['assets/images/01/Show.0'+i.toString()+'.jpg'].texture)
            }
            else
            {
                arr.push(resource['assets/images/01/Show.'+i.toString()+'.jpg'].texture)
            }

        }

       var mc=new PIXI.extras.AnimatedSprite(arr);
        // mc.gotoAndPlay(1);
        mc.animationSpeed=0.4;
        mc.width=1136;
        mc.height=640;
        page.ui.addChild(mc);
        //
        // var mc=new PIXI.extras.AnimatedSprite(arr_texture);
        // mc.anchor.set(0);
        // mc.x=0;
        // mc.y=200;
        // mc.animationSpeed=0.4;
        // mc.alpha=1;
        // mc.gotoAndPlay(1);
        // page.ui.addChild(mc);
        var bar=new PIXI.Graphics();
        bar.beginFill(0x0,1);
        bar.drawRect(0,0,1136,60);
        bar.endFill();
        bar.y=535;
        page.ui.addChild(bar);


        var t0=new PIXI.Sprite(resource['assets/images/p9_t0.png'].texture);
        t0.anchor.set(0.5);
        t0.x=563;
        t0.y=560;
        page.ui.addChild(t0);

        var t1=new PIXI.Sprite(resource['assets/images/p9_t1.png'].texture);
        t1.anchor.set(0.5);
        t1.x=563;
        t1.y=560;
        page.ui.addChild(t1);
        
        page.In=function () {
            console.log('In')
            // bg.alpha=1;
            // _mask.scale.x=_mask.scale.y=0;
            // TweenMax.to(_mask.scale,1.5,{x:1,y:1,ease:Cubic.easeInOut});

            bg.alpha=0;
            TweenMax.to(bg,0.7,{delay:0,alpha:1,ease:Cubic.easeInOut});

            mc.alpha=0;
            TweenMax.to(mc,0.7,{delay:1,alpha:1,onComplete:function () {
                mc.gotoAndPlay(1);
            }});

            bar.y=535+100;
            bar.alpha=1;
            TweenMax.to(bar,1,{delay:1.5,y:532,alpha:1,ease:Cubic.easeInOut});

            t0.alpha=0;
            TweenMax.to(t0,1.2,{delay:2,alpha:1,ease:Cubic.easeInOut});
            TweenMax.to(t0,1.2,{delay:5,alpha:0,ease:Cubic.easeInOut});
            t1.alpha=0;
            TweenMax.to(t1,1.2,{delay:7,alpha:1,ease:Cubic.easeInOut});
            TweenMax.to(t1,1.2,{delay:10,alpha:0,ease:Cubic.easeInOut});


            
            setTimeout(function () {
                var event = new CustomEvent("Game_PageIn",{'detail':10});
                document.dispatchEvent(event);
            },12000);
        }

        return page;
    }
}